<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>日志管理</title>
<link href="../../../static/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../../static/js/jquery.js"></script>
<script type="text/javascript" src="../../../static/laydate/laydate.js"></script>
<script type="text/javascript">
function tipOpen(content) {
	$(".tipright p").text(content);
	$("#tip").fadeIn(200);
}
function tipClose() {
	$("#tip").fadeOut(200);
}
</script>
  <script>
    $(function (){
      flash();
    })
    function flash(pageNum,pages){
      if(pageNum<=0){
        return;
      }
      if(pageNum>pages){
        return;
      }
      var uId = $("#jid").val();
      var uname = $("#uname").val();
      var jcontent = $("#jcontent").val();
      var moduleRname = $("#moudleRname").val();
      var logStartTime = $("#logStartTime").val();
      var logEndTime = $("#logEndTime").val();
      console.log(logEndTime);


      $.ajax({
        url:"queryLogs",
        type:"POST",
        dataType:"JSON",
        data:{pageNum:pageNum,uId:uId,uname:uname,jcontent:jcontent,moduleRname:moduleRname,logStartTime:logStartTime,logEndTime:logEndTime},
        success:function (data){
          var str = `
      <thead>
        <tr>
          <th>序号</th>
          <th>员工编号</th>
          <th>员工姓名</th>
          <th>操作模块</th>
          <th>日志内容</th>
          <th>记录时间</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>`;
          for(let i=0;i<data.list.length;i++){
            str+=`<tr>
          <td>${data.list[i].jid}</td>
          <td>${data.list[i].uid}</td>
          <td>${data.list[i].lusers.uname}</td>
          <td>${data.list[i].module.moduleRname}</td>
          <td>${data.list[i].jcontent}</td>
          <td>${data.list[i].jdate}</td>
          <td>
            <a href="logView" class="tablelink">查看日志信息</a>
          </td>
        </tr>`;
          }
          str+=`</tbody>`;

          str2=`<div class="message">共<i class="blue">${data.pages}</i>条记录，当前显示第&nbsp;<i class="blue">${data.pageNum}&nbsp;</i>页</div>
                <ul class="paginList">
                <li class="paginItem"><a href="javascript:;" onclick="flash(${data.pageNum-1})"><span class="pagepre"></span></a></li>
                <li class="paginItem"><a href="javascript:;" onclick="flash(1)">首页</a></li>`;




          for(let i=0;i<data.navigatepageNums.length;i++){
            let j = data.navigatepageNums[i];
            str2+=`<li class="paginItem"><a href="javascript:;" onclick="flash(${j})">${j}</a></li>`
          }
          str2+=`<li class="paginItem"><a href="javascript:;" onclick="flash(${data.pages})">末页</a></li>
                    <li class="paginItem"><a href="javascript:;" onclick="flash(${data.pageNum+1},${data.pages})"><span class="pagenxt"></span></a></li>
      </ul>`;
          $("#thePage").html(str2);
          $("#tab").html(str);
          console.log(data);
        },
        error:function (){
          alert("查询条件有误");
        }
      });
    }


  </script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li><a href="../users/userList.html">系统管理</a></li>
    <li><a href="#">日志管理</a></li>
  </ul>
</div>
<div class="rightinfo">
  <form action="" method="post" id="form">
    <ul class="tools">
      <li> <label>员工编号:</label>
        <input type="text" name="jId" id="jid"/>
      </li>
      <li> <label>员工姓名:</label>
        <input type="text" name="uname" id="uname"/>
      </li>
      <li> <label>日志内容：</label>
        <input type="text" name="jcontent" id="jcontent"/>
      </li>
      <li> <label>操作模块：</label>
        <input type="text" name="moduleRname" id="moudleRname"/>
      </li>
      <li> <label>记录时间:</label>
        <input type="text" class="laydate-icon" name="date1" id="logStartTime"/>
        <label>-</label>
        <input type="text" class="laydate-icon" name="date2" id="logEndTime"/>
      </li>
      <li class="subBut" onclick="flash(1,1)"><img src="../../../static/images/t06.png" />查询</li>
    </ul>
    <table class="tablelist" id="tab">

    </table>
    <div class="pagin" id="thePage">

    </div>
  </form>
  <!-- 提示框 -->
  <div id="tip" class="tip">
    <div class="tiptop"><span>提示信息</span><a onclick="tipClose()"></a></div>
    <div class="tipinfo"> <span><img src="../../../static/images/ticon.png" /></span>
      <div class="tipright">
        <p></p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite> </div>
    </div>
    <div class="tipbtn">
      <input name="" type="button"  class="sure" value="确定" onclick="tipClose()" />
      &nbsp;
      <input name="" type="button"  class="cancel" value="取消" onclick="tipClose()" />
    </div>
  </div>
</div>
<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');

    var start = {
      elem: '#logStartTime',
      format: 'YYYY-MM-DD hh:mm:ss',
      max: '2099-06-16', //最大日期
      istime: true,
      istoday: false,
      choose: function(datas){
        end.min = datas; //开始日选好后，重置结束日的最小日期
        end.start = datas; //将结束日的初始值设定为开始日
      }
    };

    var end = {
      elem: '#logEndTime',
      format: 'YYYY-MM-DD hh:mm:ss',
      max: '2099-06-16',
      istime: true,
      istoday: false,
      choose: function(datas){
        start.max = datas; //结束日选好后，充值开始日的最大日期
      }
    };
    laydate.skin('molv');//切换皮肤，请查看skins下面皮肤库
    laydate(start);
    laydate(end);
</script>
</body>
</html>
